package io.mft.flow.core.executable.drive;

import io.mft.commons.function.ExecuteReturn;
import io.mft.flow.core.executable.ChainCondition;
import io.mft.flow.data.ChainContext;
import io.mft.flow.data.ExecutableRequest;
import io.mft.flow.data.ExecutableResponse;

/**
 * 流程逻辑单元驱动接口
 * 
 * @说明：TODO
 * @类型名称：ChainConditionDriver
 * @创建者: 胡常建
 * @创建时间: 2021年3月3日 上午9:06:37
 * @修改者: 胡常建
 * @修改时间: 2021年3月3日 上午9:06:37
 */
public abstract class ChainConditionDriver {
	
	
	
	
	protected ExecuteReturn executeNextChainCondition(ChainContext context, ChainCondition nextChainCondition, ExecutableRequest request,
			ExecutableResponse response) throws Exception {
		ChainContext chainContext = new ChainContext(context.getChainName(),context.getRequest(),request, response,context.getExecutableUniqueId());
		return nextChainCondition.execute(chainContext);
	}
	private ChainCondition chainCondition;
	public void chainCondition(ChainCondition chainCondition) {
		this.chainCondition=chainCondition;
	}
	
	public ChainCondition chainCondition() {
		return chainCondition;
	}
	public abstract ExecuteReturn drive(ChainContext contex,ConditionDriveSourceProvider conditionDriveSourceProvider) throws Exception;
	
	public abstract ConditionDriverType conditionDriverType();
}
